<?php include_once './application/views/sys_admin/common/header.php';  ?>
<!-- admin_main -->
<div class=" definewidth m20">
	<form id="borrowForm" name="borrowForm" >
	<table class="table table-bordered table-hover m10">
		 <tr>
	        <td class="tableleft"><span style="color:#f00;">*</span>标产品 </td>
	        <td>
	        <select id="ftype" name="ftype" class="pubput" >
						<option value="0" >--请选择标产品--</option>
						<?php foreach($borrow_type as $key=>$value){?>
						<option value="<?php echo $key;?>" >
							<?php echo $value;?></option>
						<?php }?>
					</select>
	        </td>
	        <td class="tableleft"><span style="color:#f00;">*</span>标的名称</td>
	        <td><input class="input" type="text" name="title" id="title" value="" size="30" /> </td>
	        <td class="tableleft"><span style="color:#f00;">*</span>融资金额 </td>
	        <td><input type="text" class="pubinput" name="account" id="account" value="" />元 </td>
	    </tr>
	    <tr>
	        <td class="tableleft"><span style="color:#f00;">*</span>收益利率 </td>
	        <td><input type="text" class="pubinput" name="apr" id="apr" value="" />% </td>
	        <td class="tableleft">预约发标时间 </td>
	        <td><input type="text" id="auto_verify_time" name="auto_verify_time"  value=""  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})" readonly="readonly"  class="Wdate"/> </td>
	        <td class="tableleft">标的起始时间 </td>
	        <td><input type="text" id="bill_starttime" name="bill_starttime"   value="" readonly="readonly"  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})"  class="Wdate"/> </td>
	    </tr>
	    <tr>
	        <td class="tableleft">标的期限 </td>
	        <td>
	        <select id="time_limit" name="time_limit" onchange="billLimitTimes();">
				<option value="0" >请选择标的期限</option>
				<?php foreach($borrow_time_limit as $key=>$value){?>
					<option value="<?php echo $key;?>"><?php echo $value;?></option><?php }?>
			</select>按天<input type="checkbox" name="is_day" id="is_day" value="1" />
	       <select id="time_limit_day" name="time_limit_day"  style="display:none;" onchange="billTimes();">
				<?php foreach($borrow_day_time_limit as $key=>$value){?>
				<option value="<?php echo $key;?>"><?php echo $value;?></option>
				<?php }?>
			</select>
	        </td>
	        <td class="tableleft">投资周期 </td>
	        <td><input type="text" readonly="readonly"   name="bill_times" id="bill_times" value=""  class="pubput"/>天 </td>
	        <td class="tableleft">计息方式 </td>
	        <td> 
	        	<?php foreach ($borrow_work_time as $wk=>$wt){?>
					<input type="radio"  value="<?php echo $wk;?>"  checked id="work_time" name="work_time"><?php echo $wt;?>
				<?php }?>
	        </td>
	    </tr>
	    <tr>
	        <td class="tableleft">还款日</td>
	        <td><input type="text" id="each_time" name="each_time" class="pubinput" style="width: 150px;" value=""  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})" readonly="readonly" /> </td>
	        <td class="tableleft">还款方式 </td>
	        <td>
	        	<select id="style" name="style" class="pubput">
				<option value="0" >--请选择还款方式--</option>
				<?php foreach($borrow_style as $key=>$value){?><option  value="<?php echo $key;?>"><?php echo $value;?></option><?php }?>
				</select> 
	        </td>
	        <td class="tableleft">T+N还款天数</td>
	        <td><input type="text" name="delay_repay" id="delay_repay" value="0"  class="pubinput"/></td>
	    </tr>
	    <tr>
	        <td class="tableleft">最大投资金额 </td>
	        <td><input type="text" name="most_account" id="most_account" value=""  class="pubinput"/> </td>
	        <td class="tableleft">最小投资金额 </td>
	        <td><input type="text" name="lowest_account" id="lowest_account" value="50"  class="pubinput"/> </td>
	        
	        <!-- 
	        <td class="tableleft">标的安全等级 </td>
	        <td>
	        <select id="fsafe" name="fsafe" class="pubput">
				<option value="0" >--请选择标的安全等级--</option>
				<?php foreach($borrow_fsafe as $sk=>$safe){?>
				<option   value="<?php echo $sk;?>" ><?php echo $safe[0];?></option>
				<?php }?>
			</select>
			</td>
			 -->
			 
			 	        <td class="tableleft"><span style="color:#f00;">*</span>资金用途 </td>
	        <td>
	        <select id="hong_fuse" name="fuse" class="pubput">
				<?php foreach($borrow_fuse as $fk=>$fuse){?>
				<option  value="<?php echo $fk;?>" ><?php echo $fuse;?></option>
				<?php }?>
			</select>
			</td>
	    </tr>

	     <tr>

	        <td class="tableleft"><span style="color:#f00;">*</span>借款用户编号 </td>
	        <td><input type="text" name="brw_userid" id="brw_userid" class="pubinput" value = ""/> </td>
	        <td class="tableleft">担保用户编号 </td>
	        <td><input type="text" name="brw_userid_loan" id="brw_userid_loan"  class="pubinput" value = ""/> </td>
	        <td class="tableleft"><span style="color:#f00;">*</span>逾期天数 </td>
	        <td><input type="text" name="late_days" id="late_days" value = "30" class="pubinput" value = ""/>天 </td>
	    </tr>
	     <tr>
	        <td class="tableleft"><span style="color:#f00;">*</span>逾期日利率 </td>
	        <td><input type="text" name="late_apr" id="late_apr" value = "0.0001"  class="pubinput" value = ""/> </td>
			<td class="tableleft">客户奖励 </td>
	        <td>
	        <?php foreach ($borrow_award as $wk=>$wt){?>
				<input type="radio" value="<?php echo $wk;?>"  checked id="award" name="award" onclick="baward(this)"><?php echo $wt;?>
			<?php }?>
			</td>
	        <td class="tableleft">奖励<span id="fundaward">比例</span> </td>
	        <td><input type="text" name="funds" id="funds" value="" class="pubinput"/><span id="fundsname"></span> </td>
	  <!--       
	        	        <td class="tableleft">自动投标比例 </td>
	        <td><input type="text" name="auto_apr" id="auto_apr" value="0" class="pubinput"/>% </td>
	         -->
	    </tr>
	    <tr>
	    	<td class="tableleft">自动投标比例</td>
	    	<td><input type="text" class="pubinput" name="auto_apr" id="auto_apr" value="0" />% </td>
	    	<td class="tableleft"></td>
	    	<td></td>
	    	<td class="tableleft"></td>
	    	<td></td>
	    </tr>
	    
	 </table>
	 <h3>背景调查审核</h3>
	<?php foreach($borrow_fsubject as $sk=>$subject){?>
		<div style="width:99%;overflow:hidden;">
		<input type="checkbox"  value="<?php echo $sk;?>" name="fsubjectid[]" onclick="bgSubject(this);">&nbsp;<?php echo $subject;?>
		
		<ul style="padding-left:14px;display:none;" id="background_investigation_<?php echo $sk;?>" >
			<li>
				<a  href="javascript:;" onclick="add_fsubject(<?php echo $sk;?>);" class="addtr">上传文件</a>
				<div>
				<ul id="file_att_<?php echo $sk;?>">
				</ul>
				</div>								
			</li>								
		</ul>
		</div>
	<?php }?>
	<hr>
	<h3>标的安全性审核</h3>
		<div class="borrow_content_wrap" >
		<table class="table table-bordered table-hover m10">
		        <tr>
	        <td class="tableleft">标的图片1</td>
	        <td><input type="file" name="f_file[]" id="bill_edition1"/> </td>
	        </tr>
	        <tr>
	        <td class="tableleft">标的图片2 </td>
	        <td><input type="file" name="f_file[]" id="bill_edition2"/> </td>
	        </tr>
	        <tr>
	        <td class="tableleft">标的图片3 </td>
	        <td><input type="file" name="f_file[]" id="bill_edition3"/> </td>
	        </tr>
	        <tr>
	        <td class="tableleft">标的图片4 </td>
	        <td><input type="file" name="f_file[]" id="bill_edition4"/> </td>
	        </tr>
	        <tr>
	        <td class="tableleft">标的图片5 </td>
	        <td><input type="file" name="f_file[]" id="bill_edition5"/> </td>
	        </tr>
	        <tr>
	        <td class="tableleft">标的图片6 </td>
	        <td><input type="file" name="f_file[]" id="bill_edition6"/> </td>
	        </tr>
	        <tr>
	        <td class="tableleft">标的图片7 </td>
	        <td><input type="file" name="f_file[]" id="bill_edition7"/> </td>
	        </tr>
	        <tr>
	        <td class="tableleft">标的图片8 </td>
	        <td><input type="file" name="f_file[]" id="bill_edition8"/> </td>
	        </tr>
	        <tr>
	        <td class="tableleft">标的图片9 </td>
	        <td><input type="file" name="f_file[]" id="bill_edition9"/> </td>
	        </tr>
	        <td class="tableleft">标的图片10 </td>
	        <td><input type="file" name="f_file[]" id="bill_edition10"/> </td>
	        </tr>
	        <tr>
	        <td class="tableleft">标的图片11 </td>
	        <td><input type="file" name="f_file[]" id="bill_edition11"/> </td>
	        </tr>
	        <tr>
	        <td class="tableleft">标的图片12 </td>
	        <td><input type="file" name="f_file[]" id="bill_edition12"/> </td>
	        </tr>
	        <tr>
	        <td class="tableleft">标的图片13 </td>
	        <td><input type="file" name="f_file[]" id="bill_edition13"/> </td>
	        </tr>
	        <tr>
	        <td class="tableleft">标的图片14 </td>
	        <td><input type="file" name="f_file[]" id="bill_edition14"/> </td>
	        </tr>
	        <tr>
	        <td class="tableleft">质押借款协议 </td>
	        <td><input type="file" name="f_file[]" id="bill_protocol"/> </td>
	        </tr>
		</table>
		</div>
	<!-- 
		 <div class="borrow_content_wrap" style = "display: none" id = "bill_piao">
		 <table class="table table-bordered table-hover m10">
		 	<tr>
	        <td class="tableleft">真伪鉴定 </td>
	        <td><input class="input" style="width:500px;" type="text" name="bill_identification" id="bill_identification" value="真票" size="30" /> </td>
	        </tr>
	        <tr>
	        <td class="tableleft">鉴定单位 </td>
	        <td><input class="input" style="width:500px;" type="text" name="bill_unit" id="bill_unit" value="" size="30" /> </td>
	        </tr>
	        <tr>
	        <td class="tableleft">完好性 </td>
	        <td>
				<input type="radio" checked  value="<?php echo 1;?>" id="bill_good" name="bill_good">
				完整
	        </td>
	        </tr>
	        <tr>
	        <td class="tableleft">字体清晰度 </td>
	        <td><input class="input" style="width:500px;" type="text" name="bill_clarity" id="bill_clarity" value="清晰" size="30" /> </td>
	        </tr>
	        <tr>
	        <td class="tableleft">用章合规性 </td>
	        <td><input class="input" style="width:500px;" type="text" name="bill_compliance" id="bill_compliance" value="合规" size="30" /> </td>
	        </tr>
	        <tr>
	        <td class="tableleft">资金用途 </td>
	        <td>
	        <select id="fuse" name="fuse" class="pubput">
			<option value="0" >--请选择资金用途--</option>
			<?php foreach($borrow_fuse as $fk=>$fuse){?>
			<option  selected="selected" value="<?php echo $fk;?>" ><?php echo $fuse;?></option>
			<?php }?>
			</select>
	        </td>
	        </tr>
	        <tr>
	        <td class="tableleft">承兑银行 </td>
	        <td>
	        <select name="bill_bank" id="bill_bank" class="pubput">
						<option value="0" >--请选择承兑银行--</option>
						<?php foreach($borrow_bill_bank as $sk=>$bank){?>
							<option selected="selected" value="<?php echo $sk;?>" ><?php echo $bank;?></option>
						<?php }?>
			</select> 
	        </td>
	        </tr>
	        <tr>
	         <td class="tableleft">保障方式 </td>
	        <td><textarea rows="8" style = "width:807px;height:84px"  id="security_mode" name="security_mode"></textarea> </td>
	        </tr>
	        <tr>
	        <td class="tableleft">产品亮点 </td>
	        <td><textarea rows="8" style = "width:807px;height:84px" id="summary" name="summary"></textarea> </td>
	        </tr>
	        <tr>
	         <td class="tableleft">审核时间 </td>
	        <td><input type="text" name="works_hours" id="works_hours" value=""  class="pubinput"/>小时<font>*默认24小时审核完成</font> </td>
	        </tr>
	        </table>
	      </div> -->
	      
	      <div class="borrow_content_wrap" style = "display: none" id = "bill_hong">
	      <table class="table table-bordered table-hover m10">
	        <tr>
	        <td class="tableleft" width ="10%" >借款人信息 </td>
	        <td ><textarea rows="4"  style = "width:807px;height:84px" id="hong_bill_identification" name="hong_bill_identification"></textarea> </td>
	        </tr>
	        <tr>
	         <td class="tableleft">借款描述 </td>
	        <td><textarea rows="4" style = "width:807px;height:84px"  id="hong_bill_unit" name="hong_bill_unit"></textarea> </td>
	       </tr>
	        <tr>
	        <td class="tableleft">还款来源 </td>
	        <td><textarea rows="4" style = "width:807px;height:84px" id="hong_bill_clarity" name="hong_bill_clarity"></textarea> </td>
	        </tr>
	        <tr>
	         <td class="tableleft">抵押详情 </td>
	        <td><textarea rows="4" style = "width:807px;height:84px" id="hong_security_mode" name="hong_security_mode"></textarea> </td>
	        </tr>
	        <tr>
	        <td class="tableleft">产品亮点 </td>
	        <td><textarea rows="4" style = "width:807px;height:84px" id="hong_summary" name="hong_summary"></textarea> </td>
	        </tr>
	        </table>
	       </div>
	<hr>
	 <button type="button" class="btn btn-success"  onclick="borrowSubmit();" >提交</button>
	</form>
</div>

<div id="dialog" title="系统提示" style="display:none"><p id="msg" style="text-align:center"></p></div>

<div id="fsubjectdialog" title="系统提示" style="display:none"><p id="msg" style="text-align:center"></p>
<div id="borrow_upload_view"></div>
</div>
<script type="text/javascript" defer>
//是否勾选天标
$("#is_day").click(function(){
	if($("#is_day").is(":checked")){
		$("#time_limit_day").show();
		$("#time_limit").attr("disabled",true);
		$("#time_limit").val(1);
		$("#bill_times").val(3);
		$("#style").val(3);
		$("#style").attr("disabled",true);
	}else{
		$("#time_limit_day").hide();
		$("#time_limit").attr("disabled",false);
		$("#style").attr("disabled",false);
		$("#bill_times").val(30);
		//$("#each_time").val("");
	}
});

function borrowSubmit(){
	
	var options = {
		url : '/sys_admin/borrow/add/',
		beforeSubmit:  checkBorrowForm,
		dataType: "json",
		type:"post",
		success : function(ret) {
			if(ret.msg > 0){
				alert("操作成功");
				window.location.href ='/sys_admin/borrow/zhs_borrow_verify_list';
			}else{
				alert(ret.msg);
			}
			
		}
	};
	$("#borrowForm").ajaxSubmit(options);
	return false;
}
</script>

